<template>
  <div>
    <Header></Header>
    <section>
      <Routers></Routers>
      <div id="section" class="main">
        <div class="common_header">
          <span class="common_header_tip">创新能力管理</span>
          <button class="common_header_btn" @click="linkTOadd">添加</button>
        </div>
        <div class="detail_box">
          <ul class="detail_list">
            <li><span class="detail_title">年度：</span><span class="detail_content">{{year}}年</span></li>
          </ul>
          <div class="detail_chang_content">
            <div>
              <p class="detail_title">知识产权对企业竞争力的作用：</p>
              <p class="detail_content">{{detail1}}</p>
            </div>
            <div>
              <p class="detail_title">科技成果转化情况：</p>
              <p class="detail_content">{{detail2}}</p>
            </div>
            <div>
              <p class="detail_title">研究开发与技术创新组织管理情况：</p>
              <p class="detail_content">{{detail3}}</p>
            </div>
            <div>
              <p class="detail_title">管理与科技人员情况：</p>
              <p class="detail_content">{{detail4}}</p>
            </div>
          </div>
          <div class="detail_operation_box">
            <button class="editBTN" @click="linkTOedit">编辑</button>
            <button class="delBTN" @click="del">删除</button>
          </div>
        </div>

        <!--删除确认框 -->
        <div class="tankuang_box" v-if="delISshow">
          <div class="tankuang">
            <p class="tankuangMSG">确认删除吗？</p>
            <div class="tankuang_btn_box">
              <button class="tankuang_ok_btn" @click="delBTN">确认</button>
              <button class="tankuang_ok_btn" @click="cancelDel">取消</button>
            </div>
          </div>
        </div>

      </div>
    </section>
  </div>
</template>

<script>
  import Routers from '@/template/routers.vue'
  import Header from '@/template/common_header.vue'
  import { Toast } from 'mint-ui';
  export default {
    name: 'abilityToInnovate_detail',
    components: {
      Routers,
      Header
    },
    data () {
      return {
        id:'',
        year:'',
        detail1:'',
        detail2:'',
        detail3:'',
        detail4:'',
        /*基础控制*/
        delISshow:false,
      }
    },
    mounted: function() {
//      console.log(this.$route.params.id)
      this.id = this.$route.params.id
      this.axios.get('/index/show_innovate?id='+this.id).then((res)=>{
        if(res.data.code==1){
          let datas = res.data.data
          this.year = datas.year
          this.detail1 = datas.know_affect
          this.detail2 = datas.science_res
          this.detail3 = datas.research_situation
          this.detail4 = datas.science_situation
        }else{
          Toast(res.data.msg)
          return
        }
      })
    },
    methods: {
      /*跳转*/
      linkTOadd () {
        this.$router.push('/abilityToInnovate_add')
      },
      linkTOedit () {
        this.$router.push({
          path:'/abilityToInnovate_add',
          name:'abilityToInnovate_add',
          params:{
            id:this.id
          }
        })
      },
      /*删除*/
      del () {
//        e.preventDefault()
        this.delISshow = true
      },
      delBTN () {
        this.axios.post('/index/del_innovate',{
          id:this.id
        }).then((res)=>{
          if(res.data.code==1){
            this.delISshow = false
            Toast('删除成功')
            this.$router.push('/abilityToInnovate')
          }else{
            Toast(res.data.msg)
            return
          }
        })
      },
      /*基础操作*/
      cancelDel () {
        this.delISshow = false
      }
    }
  }
</script>

<style scoped>
  @import '../../assets/public.css';
  @import '//at.alicdn.com/t/font_749860_je5eki3tevb.css';

  .detail_box{
    border:1px solid #ddd;
    padding:40px;
    margin-top:30px;
    position: relative;
  }
  .detail_chang_content>div{
    margin-bottom:20px;
  }
  .detail_list{
    display: flex;
    align-items: center;
    flex-wrap: wrap;
  }
  .detail_list>li{
    width:420px;
    margin-bottom:16px;
  }
  .detail_title{
    color: #333;
    font-size:12px;
  }
  .detail_content{
    color: #888;
    font-size:12px;
  }
  .detail_chang_content .detail_content{
    line-height:25px!important;
  }
  .detail_operation_box{
    position: absolute;
    bottom:10px;
    right:10px;
    display: flex;
    align-items: center;
  }
  .detail_operation_box>button{
    width:80px;
    height:30px;
    outline: none;
    border-radius: 5px;
    font-size:14px;
    line-height: 30px;
    background-color: #fff;
    box-sizing: border-box;
    margin-left:20px;
  }
  .detail_operation_box>button.editBTN{
    border: 1px solid #4797D4;
    color: #4797D4;
  }
  .detail_operation_box>button.delBTN{
    border: 1px solid #e44d51;
    color: #e44d51;
  }

</style>
